//
//  GuestCouponHeaderFooterView.m
//  penzer
//
//  Created by 还带大道 on 2018/11/7.
//  Copyright © 2018年 caiyc. All rights reserved.
//

#import "GuestCouponHeaderFooterView.h"

@implementation GuestCouponHeaderFooterView

- (instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier
{
    if(self = [super initWithReuseIdentifier:reuseIdentifier]){
        
        self.contentView.backgroundColor = [UIColor whiteColor];
        UIImageView *imageV = [UIImageView new];
        _imageV = imageV;
        [self.contentView addSubview:imageV];
        [imageV mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(25);
            make.centerY.equalTo(self.contentView);
        }];
        
        UILabel *title = [UILabel new];
        _title = title;
        title.textColor = RZ_COLOR(74, 74, 74);
        title.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:16];
        [self.contentView addSubview:title];
        [title mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(imageV.mas_right).offset(12);
            make.centerY.equalTo(self.contentView);
        }];
        
        UIButton *rightBtn = [UIButton new];
        _rightBtn = rightBtn;
        [rightBtn addTarget:self action:@selector(rightBtnOnClick:) forControlEvents:UIControlEventTouchUpInside];
        [rightBtn setTitle:@"展开" forState:UIControlStateNormal];
        [rightBtn setTitle:@"收起" forState:UIControlStateSelected];
        [rightBtn setTitleColor:RZ_COLOR(74, 74, 74) forState:UIControlStateNormal];
        rightBtn.titleLabel.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:16];
        
        [self.contentView addSubview:rightBtn];
        [rightBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.mas_equalTo(-25);
            make.centerY.equalTo(self.contentView);
        }];
        
    }
    return self;
}


- (void)rightBtnOnClick:(UIButton *)btn
{
    !self.rightBtnOnClickBlock?:self.rightBtnOnClickBlock(btn);
}

@end
